Removed support for git versions older than 2.5.
authorJoey Hess <joeyh@joeyh.name>
Thu, 21 Aug 2025 15:04:26 +0000 (11:04 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 21 Aug 2025 15:04:26 +0000 (11:04 -0400)
This entirely removes Git.BuildVersion, which avoids the possibility that
git-annex will behave differently based on the version of git it was built
with, rather than the version it's used with.

Debian oldoldstable is the oldest version of git that git-annex needs to
support, since it's used in the amd64ancient build.

cabal configure will fail if the git version is too old.

Sponsored-by: Nicholas Golder-Manning
Build/Configure.hs
CHANGELOG
Command/Smudge.hs
Git/BuildVersion.hs [deleted file]
Git/CatFile.hs
git-annex.cabal

index 2c848ce965ae576f97c84da05a897d4a1bfcc79f..c8bebaaba6519744f12fd698c4a8c7dd36c37a69 100644 (file)
@@ -81,7 +81,7 @@ getGitVersion = go =<< getEnv "FORCE_GIT_VERSION"
        go (Just s) = return $ Config "gitversion" $ StringConfig s
        go Nothing = do
                v <- Git.Version.installed
-               let oldestallowed = Git.Version.normalize "2.1"
+               let oldestallowed = Git.Version.normalize "2.5"
                when (v < oldestallowed) $
                        error $ "installed git version " ++ show v ++ " is too old! (Need " ++ show oldestallowed ++ " or newer)"
                return $ Config "gitversion" $ StringConfig $ show v
index b7ce9fc91fda18c59e18ce063303053b56b6d8a1..7717641e649127c8c331935e60455edb53729656 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -26,6 +26,7 @@ git-annex (10.20250722) UNRELEASED; urgency=medium
     for exporttree=yes/importtree=yes remotes.
   * Bump aws build dependency to 0.24.1.
   * stack.yaml: Update to lts-24.2.
+  * Removed support for git versions older than 2.5.
 
  -- Joey Hess <id@joeyh.name>  Wed, 30 Jul 2025 13:45:42 -0400
 
index dc3854a6614055bd998bb84d9033a53f5428b91c..c381c0aa5afdc0d55fb1850eb6140cecc9880aeb 100644 (file)
@@ -19,7 +19,6 @@ import Annex.WorkTree
 import Logs.Smudge
 import Logs.Location
 import qualified Database.Keys
-import qualified Git.BuildVersion
 import Git.FilePath
 import Git.Types
 import Git.HashObject
@@ -97,15 +96,7 @@ clean file = do
        Annex.BranchState.disableUpdate -- optimisation
        b <- liftIO $ L.hGetContents stdin
        let passthrough = liftIO $ L.hPut stdout b
-       -- Before git 2.5, failing to consume all stdin here would
-       -- cause a SIGPIPE and crash it.
-       -- Newer git catches the signal and stops sending, which is
-       -- much faster. (Also, git seems to forget to free memory
-       -- when sending the file, so the less we let it send, the
-       -- less memory it will waste.)
-       let discardreststdin = if Git.BuildVersion.older "2.5"
-               then L.length b `seq` return ()
-               else liftIO $ hClose stdin
+       let discardreststdin = liftIO $ hClose stdin
        let emitpointer = liftIO . S.hPut stdout . formatPointer
        clean' file (parseLinkTargetOrPointerLazy' b)
                passthrough
diff --git a/Git/BuildVersion.hs b/Git/BuildVersion.hs
deleted file mode 100644 (file)
index f94a892..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-{- git build version
- -
- - Copyright 2011 Joey Hess <id@joeyh.name>
- -
- - Licensed under the GNU AGPL version 3 or higher.
- -}
-
-module Git.BuildVersion where
-
-import Git.Version
-import qualified BuildInfo
-
-{- Using the version it was configured for avoids running git to check its
- - version, at the cost that upgrading git won't be noticed.
- - This is only acceptable because it's rare that git's version influences
- - code's behavior. -}
-buildVersion :: GitVersion
-buildVersion = normalize BuildInfo.gitversion
-
-older :: String -> Bool
-older n = buildVersion < normalize n 
index 877186a1ae18c96e4826b28a455eab07f52bae17..a0ab7961830df788edfb37a0a9f49fc1908f5022 100644 (file)
@@ -54,7 +54,6 @@ import Git.Types
 import Git.HashObject
 import qualified Git.LsTree as LsTree
 import qualified Utility.CoProcess as CoProcess
-import qualified Git.BuildVersion as BuildVersion
 import Utility.Tuple
 
 data CatFileHandle = CatFileHandle 
@@ -403,14 +402,10 @@ withCatFileStream
 withCatFileStream check repo reader = assertLocal repo $
        bracketIO start stop $ \(c, hin, hout, _) -> reader c hin hout
   where
-       params = catMaybes
-               [ Just $ Param "cat-file"
-               , Just $ Param ("--batch" ++ (if check then "-check" else "") ++ "=" ++ batchFormat)
-               -- This option makes it faster, but is not present in
-               -- older versions of git.
-               , if BuildVersion.older "2.4.3"
-                       then Nothing
-                       else Just $ Param "--buffer"
+       params =
+               [ Param "cat-file"
+               , Param ("--batch" ++ (if check then "-check" else "") ++ "=" ++ batchFormat)
+               , Param "--buffer" -- makes it faster
                ]
 
        start = do
index bd678f1a5cc0bc27c4af847075d9620b815d27be..4fbf9f0f7f4838c337b322bfe51144df644f574a 100644 (file)
@@ -813,7 +813,6 @@ Executable git-annex
     Git
     Git.AutoCorrect
     Git.Branch
-    Git.BuildVersion
     Git.Bundle
     Git.CatFile
     Git.CheckAttr